import { GET, POST, DELETE, PUT } from '../index';

import type {
  uploadDataSetsRequest,
} from '@/types/evaluate';

import { getUserId } from '@/utils';
const userId = getUserId();

/**
 * 上传excel表
 */
export const uploadTableExcelFile = (data: uploadDataSetsRequest) => {
  return POST<uploadDataSetsRequest, Record<string, any>>(`/api/v2/serve/excel/excel_file/upload`, data, {
    headers: {
      'user-id': userId,
      'Content-Type': 'multipart/form-data',
    },
  });
};

/**
 * 文件列表
 */
export const getExcelFileList = (data: any = {}) => {
  return POST<any, null>(`/api/v2/serve/excel/excel_file/list`, data);
};


/**
 * 删除文件
 */
export const deleteExcelFile = (data: any = {}) => {
  return POST<any, null>(`/api/v2/serve/excel/excel_file/delete`, data);
};


/**
 * 收藏文件
 */
export const collectionExcelFile = (data: any = {}) => {
  return POST<any, null>(`/api/v2/serve/excel/excel_file/collection`, data);
};


/**
 * 取消收藏文件
 */
export const collectionCancelExcelFile = (data: any = {}) => {
  return POST<any, null>(`/api/v2/serve/excel/excel_file/collection_cancel`, data);
};


/**
 * 批量删除文件
 */
export const deleteBatchExcelFile = (data: any = {}) => {
  return POST<any, null>(`/api/v2/serve/excel/excel_file/delete_batch`, data);
};


/**
 * 批量收藏文件
 */
export const collectionBatchExcelFile = (data: any = {}) => {
  return POST<any, null>(`/api/v2/serve/excel/excel_file/collection_batch`, data);
};

/**
 * 读取文件
 */
export const readExcelFile = (data: any = {}) => {
  return POST<any, null>(`/api/v2/serve/excel/excel_file/read`, data);
};
// 编辑文件
export const editExcelFile = (data: any = {}) => {
  return POST<any, null>(`/api/v2/serve/excel/excel_file/edit`, data);
};
// 导出文件
export const download_file = (data: any = {}) => {
  return GET<any, null>(`/api/v2/serve/excel/excel_file/download_file/${data.id}`, {}, { responseType: 'blob', });
};
// 刷新
export const db_file_refresh = (data: any = {}) => {
  return POST<any, null>(`/api/v2/serve/excel/excel_file/db_file_refresh`, data);
};
// 右侧批量删除
export const recycle_bin_batch = (data: any = {}) => {
  return POST<any, null>(`/api/v2/serve/excel/excel_file/recycle_bin_batch`, data);
};
// 右侧删除
export const recycle_bin = (data: any = {}) => {
  return POST<any, null>(`/api/v2/serve/excel/excel_file/recycle_bin`, data);
};